package de.schneider.ekss;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class Calculator {

	private Double input;
	private Double memory;
//	private Double concatedInput = 0.0;
	private char operation = '0';

//	public void storeDigit(Double input) {
//
//		if (0 == memory) {
//
//			concatedInput = input;
//
//		} else
//			concatedInput += memory * 10;
//
//	}
	
	public void resetAll(){
		
		this.input = 0.0;
		this.memory = 0.0;
	}

	public Double add() {

		this.memory = this.input;
		this.input = 0.0;
		this.operation = '+';

		return null;
	}

//	public Double subtract() {
//
//		return null;
//	}
//
//	public Double divide() {
//
//		return null;
//	}
//
//	public Double multiply() {
//
//		return null;
//	}

	public Double calculate() {

		switch (operation) {

		case '+': 
			this.input = this.input+ this.memory;
		

			break;

		case '-':

			break;

		case '*':

			break;

		case '/':

			break;

		default:

			this.input = 0.0;
			break;
		}

		return null;
	}

	public Double getInput() {
		return input;
	}

	public void setInput(Double input) {
		this.input = input;
	}
//
//	public Double getMemory() {
//		return memory;
//	}
//
//	public void setMemory(Double memory) {
//		this.memory = memory;
//	}
//
//	public Double getConcatedInput() {
//		return concatedInput;
//	}
//
//	public void setConcatedInput(Double concatedInput) {
//		this.concatedInput = concatedInput;
//	}

}
